	;; for addresses greater than or equal to FF8000,
	;; use FFFFXXXX instead of 00FFXXXX to assist dumb assembers
	;; that are unaware that the 68000 uses 24 bit addresses
	;; and won't truncate the address to one word since the address is sign
	;; extended

	;; for sega cd, the F700-FDFF is already used (from what I can tell)
	;; FD00-FDFF is for the interrupt table
	;; the stack pointer starts at FD00
	;; only leaves FE00-FFFF (512 bytes) for the shorter word addresses
	
	;; Sprites

StartSpriteRAM:		equ $FFFFFE00
RileySprite:		equ StartSpriteRAM+$0000
TruckLeftSprite:	equ StartSpriteRAM+$0008
TruckRightSprite:	equ StartSpriteRAM+$0010
BinSprite:		equ StartSpriteRAM+$0018
LetterSprite:		equ StartSpriteRAM+$0020
Riley2Sprite:		equ StartSpriteRAM+$0028
Truck2LeftSprite:	equ StartSpriteRAM+$0030
Truck2RightSprite:	equ StartSpriteRAM+$0038
Bin2Sprite:		equ StartSpriteRAM+$0040
Letter2Sprite:		equ StartSpriteRAM+$0048
EndSpriteRAM:		equ StartSpriteRAM+$0050

	;; Globals

StartGlobalRAM:		equ EndSpriteRAM
	;; always incremented vint, should never reset, useful for animations
VintCounter:		equ StartGlobalRAM+$0000
	;; always incremented on vint, reset to time things like demos
VintWait:		equ StartGlobalRAM+$0002
	;; an absolute address pointing to the animate subroutine (0 for none)
	;; this is the last thing done before waiting for the next vint
VintAnimate:		equ StartGlobalRAM+$0004
	;; the last (pseudo) random number, seed for next random number
RandomNumber:	        equ StartGlobalRAM+$0008
	;; any port 2 button currently down
Port1Hold:		equ StartGlobalRAM+$000A
	;; any port 1 button that was just pressed down
Port1Press:		equ StartGlobalRAM+$000B
	;; any port 2 button currently down
Port2Hold:		equ StartGlobalRAM+$000C
	;; any port 2 button that was just pressed down
Port2Press:		equ StartGlobalRAM+$000D
	;; current word
StartWordLetters:	equ StartGlobalRAM+$000E
EndWordLetters:		equ StartGlobalRAM+$0012
	;; current set of numbers used for assigning potential x positions
StartWordX:		equ StartGlobalRAM+$0012
EndWordX:		equ StartGlobalRAM+$0015
	;; current set of numbers used for assigning potential y positions
StartWordY:		equ StartGlobalRAM+$0015
EndWordY:		equ StartGlobalRAM+$0018
	;; player 1 score
StartScoreAscii:        equ StartGlobalRAM+$0018
EndScoreAscii:	        equ StartGlobalRAM+$001B
	;; player 2 score
StartScoreAscii2:	equ StartGlobalRAM+$001B
EndScoreAscii2:		equ StartGlobalRAM+$001E
	;; player 1 current word index
WordIndex:		equ StartGlobalRAM+$001E
	;; player 2 current word index
WordIndex2:		equ StartGlobalRAM+$001F
	;; flags, see "bits in the Flags memory location" below
Flags:			equ StartGlobalRAM+$0020
	;; word flags, see "bits in the WordFlags memory location" below
WordFlags:		equ StartGlobalRAM+$0021
	;; how many words have been finished by all players
	;; in the current level
WordsForLevel:		equ StartGlobalRAM+$0022
	;; the next level to show for a demo
DemoLevel:		equ StartGlobalRAM+$0023
EndGlobalRAM:		equ StartGlobalRAM+$0024

	;; bits in the Flags memory location
	;; set when vint seen, used by WaitForVint
GotVintFlag:		equ 0
	;; if the fade out was called
FadeOutFlag:		equ 1
	;; if the start button was pressed (useful for catching during fades)
StartButtonFlag:	equ 2
	;; determines if 1 or 2 players are playing (or in demo)
TwoPlayerFlag:		equ 3
	;; flag if we are in
DemoFlag:		equ 4

	;; bits in the WordFlags memory location
	;; letters need to be refreshed
RefreshLettersWordFlag:	equ 0
	;; finished a word on current player
FinishedWordFlag:	equ 1
	;; all players finished the word so have a new word
NewWordFlag:		equ 2
	;; all players finished the word and have met or exceeded level word
	;; count
NewLevelFlag:		equ 3

	;; Level specific RAM (different levels overlap this RAM)

StartLevelSpecificRAM:	equ EndGlobalRAM

	;; Level 1 RAM

StartLevel1RAM:		equ StartLevelSpecificRAM
	;; the y position of riley with with 1/256 granularity
Level1RileyPositionY:	equ StartLevel1RAM+$0000
	;; the y speed of riley with with 1/256 granularity
Level1RileySpeedY:	equ StartLevel1RAM+$0004
	;; the y position of riley 2 with with 1/256 granularity
Level1Riley2PositionY:	equ StartLevel1RAM+$0006
	;; the y speed of riley 2 with with 1/256 granularity
Level1Riley2SpeedY:	equ StartLevel1RAM+$000A
EndLevel1RAM:		equ StartLevel1RAM+$000C

	;; Level 3 RAM
	
StartLevel3RAM:		equ StartLevelSpecificRAM
	;; road scrolling and tire animation with 1/256 granularity
Level3TruckPositionX:	equ StartLevel3RAM+$0000
	;; used to move the truck up or down with 1/256 granularity
Level3TruckPositionY:	equ StartLevel3RAM+$0002
	;; the desired final truck y position
Level3TruckDesiredY:	equ StartLevel3RAM+$0006
	;; the current truck speed with 1/256 granularity
Level3TruckSpeed:	equ StartLevel3RAM+$0008
	;; the current letter x position with 1/256 granularity
Level3LetterPositionX:	equ StartLevel3RAM+$000A
Level3Truck2PositionX:	equ StartLevel3RAM+$000E
Level3Truck2PositionY:	equ StartLevel3RAM+$0010
Level3Truck2DesiredY:	equ StartLevel3RAM+$0014
Level3Truck2Speed:	equ StartLevel3RAM+$0016
Level3Letter2PositionX:	equ StartLevel3RAM+$0018
EndLevel3RAM:		equ StartLevel3RAM+$002C


	;; Level 4 RAM

StartLevel4RAM:		equ StartLevelSpecificRAM
	;; the y position of riley with with 1/256 granularity
Level4RileyPositionY:	equ StartLevel4RAM+$0000
	;; the y speed of riley with with 1/256 granularity
Level4RileySpeedY:	equ StartLevel4RAM+$0004
	;; the y position of riley 2 with with 1/256 granularity
Level4Flags:		equ StartLevel4RAM+$0006
Level4Riley2PositionY:	equ StartLevel4RAM+$0008
	;; the y speed of riley 2 with with 1/256 granularity
Level4Riley2SpeedY:	equ StartLevel4RAM+$000C
	;; flags for various states
Level4Flags2:		equ StartLevel4RAM+$000E
EndLevel4RAM:		equ StartLevel4RAM+$0010

JumpLevel4Flag:		equ 0
